package forms;

import javax.validation.Valid;
import javax.validation.constraints.Digits;
import javax.validation.constraints.Min;
import javax.validation.constraints.Pattern;

import org.hibernate.validator.constraints.NotBlank;

import domain.Customer;
import domain.Order;

public class ItemForm {

	public ItemForm() {
		super();
	}

	private String referenceNumber;
	private String name;
	private String description;
	private String state;
	private double amount;
	private String currency;
	private int availableUnits;
	private int purchasedUnits;
	private Customer seller;
	private Order order;

	private int itemId;

	@NotBlank
	@Pattern(regexp = "^(\\w+-\\w+)+$")
	public String getReferenceNumber() {
		return referenceNumber;
	}

	public void setReferenceNumber(String referenceNumber) {
		this.referenceNumber = referenceNumber;
	}

	@NotBlank
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@NotBlank
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@NotBlank
	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	@Digits(integer = 12, fraction = 2)
	@Min(0)
	public Double getAmount() {
		return amount;
	}

	public void setAmount(double amount) {
		this.amount = amount;
	}

	@NotBlank
	public String getCurrency() {
		return currency;
	}

	public void setCurrency(String currency) {
		this.currency = currency;
	}

	@Min(0)
	public int getAvailableUnits() {
		return availableUnits;
	}

	public void setAvailableUnits(int availableUnits) {
		this.availableUnits = availableUnits;
	}

	// @Min(1)
	public int getPurchasedUnits() {
		return purchasedUnits;
	}

	public void setPurchasedUnits(int purchasedUnits) {
		this.purchasedUnits = purchasedUnits;
	}

	@Valid
	public Customer getSeller() {
		return seller;
	}

	public void setSeller(Customer seller) {
		this.seller = seller;
	}

	@Valid
	public Order getOrder() {
		return order;
	}

	public void setOrder(Order order) {
		this.order = order;
	}

	public int getItemId() {
		return itemId;
	}

	public void setItemId(int itemId) {
		this.itemId = itemId;
	}

}
